/**
 * 
 */
package org.sgmiller.quickstem;

/**
 * Isolation levels describe the semantics of which versions of a value are seen
 * by an open transaction.  In all isolation levels, values written by the current transactions
 * are observed in preference to any older value.
 */
public enum IsolationLevel {
	/**
	 * Transaction observes the most recent non-rolled back value of a variable.  This is the cheapest mode,
	 * but also rarely useful, as it negates most of the benefits of transactional data access, with the
	 * exception of not observing rolled back transactions.
	 */
	READ_UNCOMMITTED,
	
	/**
	 * Transaction observes the most recent committed value of a variable.
	 */
	READ_COMMITTED,
	
	/**
	 * The most expensive mode; the transaction observes the most recent committed value of 
	 * variable on its first read, and the same value on subsequent reads.  This requires
	 * O(n) memory, with n as the number of variables read during the transaction.  
	 */
	REPEATABLE_READ,
	
	/**
	 * Transaction observes the most recent committed value of a variable, and notes any 
	 * newer versions on open transactions.  At commit time, if any of those transactions have
	 * committed, an exception is thrown and the transaction rolls back.  This prevents inconsistencies
	 * due to concurrent writes during the transaction invalidating computations done on those values.  
	 */
	SERIALIZABLE, 
	
	/**
	 * Used internally to represent values written outside a transaction.
	 */
	ONE_SHOT 
}